/*
 * Copyright (C) 2009  Sylvain Maucourt (smaucourt@gmail.com)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 *
 */
package net.sylvek.where;

/**
 * MyKeys is an abstract class containing
 * 
 * static final String SECRET = "secret";
 * 
 * static final String API_KEY = "api_key";
 * 
 * @author Sylvain Maucourt (smaucourt-at-gmail.com)
 * 
 */
public class FbClient extends MyKeys {

    private FbClient()
    {
        // private constructor
    }

    protected static final String HTTPS_GRAPH = "https://graph.facebook.com/";

    protected static final String HTTP_GRAPH = "http://graph.facebook.com/";

    protected static final String URL_REDIRECT = "http://ou-android.appspot.com/client/oauth_redirect.jsp";

    protected static final String URL_ACCESS_TOKEN = HTTPS_GRAPH + "oauth/access_token?display=popup&redirect_uri="
            + URL_REDIRECT + "&client_id=" + API_KEY + "&client_secret=" + SECRET + "&code=";

    protected static final String URL_AUTH = HTTPS_GRAPH
            + "oauth/authorize?scope=offline_access,publish_stream&display=popup&redirect_uri=" + URL_REDIRECT + "&client_id=";

    protected static final String URL_PROFIL = "http://touch.facebook.com/#profile.php?id=";

    protected static final String ACCESS_TOKEN_KEY = "access_token=";

    protected static String ID;

    protected static String NAME;

    public static String parseAccessToken(final String accessToken)
    {
        if (accessToken.startsWith("access_token=")) {
            return accessToken.substring(FbClient.ACCESS_TOKEN_KEY.length());
        } else {
            return accessToken;
        }
    }

}